<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>基本信息</title>
<link type="text/css" href="../css/checkPage.css" rel="stylesheet"/>
<link type="text/css" href="../css/shCompany.css" rel="stylesheet" >
<link type="text/css" href="../js/jDialog/jDialog.css" rel="stylesheet" >
<link rel="stylesheet" type="text/css" href="../js/jquery-ui-1.11.4.custom/jquery-ui.css">
<script type="text/javascript" src="../js/jDialog/jquery.dialog.js"></script>
<script type="text/javascript" src="../js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/jquery-ui-1.11.4.custom/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/jquery-ui-1.11.4.custom/jquery-ui.min.js"></script>
<script type="text/javascript">
var sumPage=1;//总页数
var nowPage=1;//当前页数
var nowCount=1;//一页显示的条数
var sumCount=0;//总条数
var nowMin=1;//当前显示第一排的序号
var nowMax=1;//当前显示最后第一排的序号
var logObj;
var i;
$(document).ready(function() {
	var mydate = new Date();
	var today = "" + mydate.getFullYear() + "-";
	if (mydate.getMonth()+1 < 10)
		today += "0" + (mydate.getMonth() + 1) + "-";
	else
		today += (mydate.getMonth() + 1) + "-";
	if (mydate.getDate() < 10)
		today += "0" + mydate.getDate();
	else
		today += mydate.getDate();
	$("#dateDTO\\.startTime").val(today);
	$("#dateDTO\\.endTime").val(today);
	$("#dateDTO\\.startTime").datepicker({
	    	dateFormat : 'yy-mm-dd',
			yearSuffix : '年',
			showMonthAfterYear : true,
			monthNames : [ '一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月',
					'九月', '十月', '十一月', '十二月' ],
			dayNamesMin : [ '日', '一', '二', '三', '四', '五', '六' ]
	    });
	  
	$("#dateDTO\\.endTime").datepicker({
		dateFormat : 'yy-mm-dd',
		yearSuffix : '年',
		showMonthAfterYear : true,
		monthNames : [ '一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月',
				'九月', '十月', '十一月', '十二月' ],
		dayNamesMin : [ '日', '一', '二', '三', '四', '五', '六' ]
	});
	$.initFrame();
});
$.initFrame = function(){
	$("#tableInfo tr:gt(0)").remove();
	var startTime = $("#dateDTO\\.startTime").val();
	var endTime = $("#dateDTO\\.endTime").val();
	$.ajax({
		type : 'post',
		dataType : 'text',
		async: false,
		url : '../user/getLogInfo.action',
		data:{
			"dateDTO.startTime":startTime,
			"dateDTO.endTime":endTime
		},
		success : function(msg) {
			if(msg.length<=2){
				sumCount=0;
			}else{
				logObj = JSON.parse(msg);
				sumCount = logObj.length;
	 			for(i=0;i<nowCount;i++)
	 				$.appendTip(i);
	 			nowMin=1;
	 			nowMax=i;
			}
 			$("#sumCount").html(sumCount);
		}
	});
	if(sumCount == 0){
		$("#tableInfo").append("<tr><td colspan='4'>没有数据</td></tr>");
		$.InitValue(0,0);
	}else{
		if(sumCount%nowCount==0)
			sumPage=sumCount/nowCount;
		else
			sumPage=Math.floor(sumCount/nowCount)+1;//根据记录数和每页显示条数获取总页数
		$.InitValue(1,nowMax);
	}
	$.checkPagesnum();
}
$.appendTip = function(j){
	$("#tableInfo").append("<tr><td>"+(j+1)+"</td><td>"+logObj[i].loginName+"</td><td>"+logObj[i].logTime+"</td><td>"+logObj[i].logIp+"</td><td>"+logObj[i].userType+"</td></tr>");
}
</script>
<script type="text/javascript" src="../js/showInfolist.js"></script>
<body>
<div class="mineInfo">
<span id="info1">日志信息&nbsp;LOGINFO</span>
<hr style="height:1px;border:none;border-top:1px solid #555555;" />
</div>
<div id="seleDiv">
<span>一页显示</span><select onchange="$.changCount(this)"><option selected="selected">1</option><option>2</option><option>3</option><option>4</option><option>5</option></select><span>条记录</span>
<input type="text" id="dateDTO.startTime" name="dateDTO.startTime" style="margin-left:20px;width:100px;"/><span style="margin-left:20px;">到</span><input type="text" id="dateDTO.endTime" name="dateDTO.endTime" style="margin-left:20px;width:100px;"/><input type="button" value="搜索" onclick="$.initFrame()">
</div>
<table id="tableInfo" border="1" rules="rows">
<tr>
<th width="15%">序号</th>
<th width="15%">用户名</th>
<th width="25%">登录时间</th>
<th width="25%">登录IP</th>
<th width="15%">登录类型</th>
</tr>
</table>
<div id="pageButton">
<a>当前显示<span id="firtLine" style="font-weight:bold;">0</span><span>到</span><span id="lastLine" style="font-weight:bold;">0</span><span>条,共</span><span id="sumCount" style="font-weight:bold;">2</span><span>条记录</span></a>
<a>第<span style="font-weight:bold;" id="nopage">1</span>/<span style="font-weight:bold;" id="alpage">1</span>页</a>
<span id="cpage"><a onclick="$.firstPage()" id="fipage">首页</a>
<a onclick="$.formPage()" id="fopage">上一页</a>
<a onclick="$.nextPage()" id="nepage">下一页</a>
<a onclick="$.lastPage()" id="lapage">尾页</a></span>
</div>
</body>
</html>